package com.zwan.oam_rtc.utils.messages;

import java.nio.ByteBuffer;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;



public class SendHttpMessage extends AbstractStruct {
    
//    callflowid	Varchar2(20)
//    callbackurl	Varchar2(300)
//    method	Varchar2(10)

    private byte[] messageBodyHeader = new byte[8];
    //private byte[] callFlowId = new byte[50];
    private byte[] callFlowId = new byte[20];
    private byte[] url = new byte[300];
    private byte[] method = new byte[20];
    
    private static int LENGTH = 348;
    
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(messageBodyHeader);
        bf.put(callFlowId);
        bf.put(url);
        bf.put(method);
    }

    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(messageBodyHeader);
        bf.get(callFlowId);
        bf.get(url);
        bf.get(method);
    }

    public String getCallFlowId() {
        return ByteTransfer.getString(callFlowId);
    }

    public void setCallFlowId(String callFlowId) {
    	ByteTransfer.str2Byte(callFlowId, this.callFlowId);
    }
    
    public String getUrl() {
        return ByteTransfer.getString(url);
    }

    public void setUrl(String url) {
    	ByteTransfer.str2Byte(url, this.url);
    }
    
    public String getMethod(){
    	return ByteTransfer.getString(method);
    }
    
    public void setMethod(String method){
    	ByteTransfer.str2Byte(method, this.method);
    }

    @Override
    public int getLength() {
        return LENGTH;
    }

}
